//
//  HomePageUserNewsOnlyContentCell.m
//  ShowYork
//
//  Created by hxh on 2020/10/12.
//  Copyright © 2020 hxh. All rights reserved.
//

#import "HomePageUserNewsOnlyContentCell.h"

@interface HomePageUserNewsOnlyContentCell ()
@property (nonatomic,strong)UIView *coverView;
@property (nonatomic,strong)UILabel *contentLb;
@property (nonatomic,strong)UIView *titleView;
@property (nonatomic,strong)UILabel *titleLb;
@end

@implementation HomePageUserNewsOnlyContentCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setUI];
    }
    return self;
}

- (void)setUI{
    
    self.backgroundColor = RGBA(16, 21, 34, 1);
    
    self.coverView = [[UIView alloc]init];
    self.coverView.backgroundColor = RGBA(33, 38, 51, 1);
    [self.contentView addSubview:self.coverView];
    
    [self.coverView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView);
        make.top.bottom.equalTo(self.contentView);
        make.right.equalTo(self.contentView).offset(-16);
    }];
    
    self.contentLb = [[UILabel alloc]init];
    self.contentLb.text = @"我们一路相伴的岁月中，每一个人为我们一路相伴的岁月中，每一个人为了";
    self.contentLb.textColor = UIColor.whiteColor;
    self.contentLb.font = font(14);
    self.contentLb.backgroundColor = RGBA(33, 38, 51, 1);
    [self.coverView addSubview:self.contentLb];
    [self.contentLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.coverView).offset(6);
        make.right.equalTo(self.coverView);
        make.top.equalTo(self.coverView).offset(10);
        make.bottom.equalTo(self.coverView).offset(-10);
    }];
    
    self.titleView = [[UIView alloc]init];
    self.titleView.backgroundColor = RGBA(0, 0, 0, 0.5);
    [self.contentView addSubview:self.titleView];
    
    self.titleLb = [[UILabel alloc]init];
    self.titleLb.text = @"审核中";
    self.titleLb.textColor = [UIColor whiteColor];
    self.titleLb.font = font(10);
    [self.titleView addSubview:self.titleLb];
    
    
    [self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(42, 20));
        make.left.top.equalTo(self.contentView);
    }];
    [self.titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self.titleView);
    }];
}
- (void)setContent:(NSString *)content{
    self.contentLb.text = content;
}
- (void)setModel:(HomePageItemModel *)model{
    _model = model;
    self.contentLb.text = model.contentText;
    if ([[RPAppManager getCustomerId] isEqualToNumber:model.userId]) {
        self.titleView.hidden = model.isDisplay.intValue == 1;
    }else{
        self.titleView.hidden = YES;
    }
}
@end
